#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    child_dialog = new ChildDialog(this);
    connect(ui->showchildButton, &QPushButton::clicked, this, &MainWindow::showchildDialog);
}

MainWindow::~MainWindow()
{
    delete ui;
    if(child_dialog)
        delete child_dialog;
    child_dialog = nullptr;
}

void MainWindow::showchildDialog()
{
    child_dialog->show();
    this->hide();
}
